package com.cf.dao.impl;

import com.cf.dao.ActiveDao;
import com.cf.dao.db.BaseDao;
import com.cf.dao.entity.Active;
import com.cf.dao.entity.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.Connection;
import java.sql.SQLException;

public class ActiveDaoImpl extends BaseDao implements ActiveDao {
    //获取所有活动
    @Override
    public Active active() throws SQLException {
        QueryRunner qr = new QueryRunner(getDataSource());
        String sql = "SELECT * FROM activeimformation ";
        try (Connection conn = getDataSource().getConnection()) {
            return qr.query(conn, sql, new BeanHandler<>(Active.class));
        }
    }
}
